from turbogears.widgets import Widget, CompoundWidget


class NoteWidget(Widget):
    template        = 'whatwhat.widgets.templates.note'
    params          = ['note', 'read_only']
    read_only       = False

note_widget = NoteWidget()

class NotesWidget(CompoundWidget):
    template        = 'whatwhat.widgets.templates.notes'
    params          = ['notes', 'read_only']
    member_widgets  = ['note_widget']
    note_widget     = note_widget
    read_only       = False

notes_widget = NotesWidget()

class RiskWidget(Widget):
    template        = 'whatwhat.widgets.templates.risk'
    params          = ['risk', 'read_only']
    read_only       = False

risk_widget = RiskWidget()

class RisksWidget(CompoundWidget):
    template        = 'whatwhat.widgets.templates.risks'
    params          = ['risks', 'read_only', 'show_closed']
    member_widgets  = ['risk_widget']
    risk_widget     = risk_widget
    read_only       = False
    show_closed     = False

risks_widget = RisksWidget()

class IssueWidget(Widget):
    template        = 'whatwhat.widgets.templates.issue'
    params          = ['issue', 'read_only']
    read_only       = False

issue_widget = IssueWidget()

class IssuesWidget(CompoundWidget):
    template        = 'whatwhat.widgets.templates.issues'
    params          = ['issues', 'read_only', 'show_closed']
    member_widgets  = ['issue_widget']
    issue_widget    = issue_widget
    read_only       = False
    show_closed     = False

issues_widget = IssuesWidget()

class AnswerWidget(Widget):
    template        = 'whatwhat.widgets.templates.answer'
    params          = ['answer', 'read_only']
    read_only       = False

answer_widget = AnswerWidget()

class AnswersWidget(CompoundWidget):
    template        = 'whatwhat.widgets.templates.answers'
    params          = ['answers', 'question_id', 'read_only']
    member_widgets  = ['answer_widget']
    answer_widget   = answer_widget
    read_only       = False

answers_widget = AnswersWidget()


class QuestionWidget(CompoundWidget):
    template        = 'whatwhat.widgets.templates.question'
    params          = ['question', 'read_only']
    member_widgets  = ['answers_widget']
    answers_widget  = answers_widget
    read_only       = False

question_widget = QuestionWidget()

class QuestionsWidget(CompoundWidget):
    template        = 'whatwhat.widgets.templates.questions'
    params          = ['questions', 'read_only']
    member_widgets  = ['question_widget']
    question_widget = question_widget
    read_only       = False

questions_widget = QuestionsWidget()
